﻿@{
    ViewBag.Title = "Product";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section scripts{
<script src="~/Areas/Mms/ViewModels/mms.com.js"></script>
<script src="~/Areas/Mms/ViewModels/mms.viewModel.searchEdit.js"></script>
<script type="text/javascript">
    using('numberbox');
    var data = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
    ko.bindingViewModel(new mms.viewModel.searchEdit(data));
</script>
}

<div class="z-toolbar">
    <a href="#" plain="true" class="easyui-linkbutton"  icon="icon-arrow_refresh"   title="刷新" data-bind="click:refreshClick">刷新</a>
    <a href="#" plain="true" class="easyui-linkbutton"  icon="icon-add"             title="新增" data-bind="click:addClick"    >新增</a>
    <a href="#" plain="true" class="easyui-linkbutton"  icon="icon-edit"            title="编辑" data-bind="click:editClick"   >编辑</a>
    <a href="#" plain="true" class="easyui-linkbutton"  icon="icon-cross"           title="删除" data-bind="click:deleteClick" >删除</a>
    <a href="#" plain="true" class="easyui-linkbutton"  icon="icon-save"     title="保存" data-bind="click:saveClick"  >保存</a>
    <a href="#" plain="true" class="easyui-splitbutton" data-options="menu:'#dropdown',iconCls:'icon-download'"                >导出</a>
</div>

<div id="dropdown" style="width:100px; display:none;">  
    <div data-options="iconCls:'icon-ext-xls'"      suffix="xls"    data-bind="click:downloadClick">Excel2003   </div>  
    <div data-options="iconCls:'icon-page_excel'"   suffix="xlsx"   data-bind="click:downloadClick">Excel2007   </div>  
    <div data-options="iconCls:'icon-ext-doc'"      suffix="doc"    data-bind="click:downloadClick">Word2003    </div>  
</div> 

<div id="condition" class="container_12" style="position:relative;">
    <div class="grid_1 lbl">品名</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.ProductName" class="z-txt"/></div>
    <div class="grid_1 lbl">颜色</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.Color" class="z-txt" /></div>
    <div class="grid_1 lbl">单价</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.Price" class="z-txt"/></div>
   
    <div class="clear"></div>
       
    <div class="grid_1 lbl">单位</div>
    <div class="grid_2 val"><input type="text" data-bind="datasource:dataSource.UnitItems ,comboboxValue:form.Unit" class="z-txt easyui-combobox" data-options="showblank:true"/></div>
    <div class="grid_1 lbl">备注</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.Remark" class="z-txt" /></div>
    <div class="grid_1 lbl">创建时间</div>
    <div class="grid_2 val"><input type="text" data-bind="value:form.CreateDate" class="easyui-daterange z-txt" /></div>
 
    <div class="clear"></div>

    <div class="prefix_9" style="position:absolute;top:5px;height:0;">  
        <a id="a_search" href="#" class="button button-blue" data-bind="click:searchClick" style="margin:0 15px;">查询</a> 
        <a id="a_reset"  href="#" class="button button-blue" data-bind="click:clearClick">清空</a>
    </div>
</div>

<table data-bind="datagrid:grid" >
    <thead>  
        <tr>  
            <th field="ID"              sortable="true" align="left"    width="90"  editor="text"                            >编号   </th>  
            <th field="ProductName"     sortable="true" align="left"    width="200" editor="text"                             >品名     </th> 
            <th field="Color"           sortable="true" align="center"  width="70"  editor="text"                              >颜色   </th> 
            <th field="Price"           sortable="true" align="left"    width="100" editor="{type: 'numberbox',options:{min: 0, precision: 2}}" >单价   </th> 
            <th field="Unit"            sortable="true" align="left"    width="100" editor="{type:'combobox',options:{data:data.dataSource.UnitItems}}" >单位       </th> 
            <th field="Money"           sortable="true" align="center"  width="80"  editor="{type: 'numberbox',options:{min: 0, precision: 2}}"  formatter="com.formatMoney">金额   </th>  
            <th field="Qty"             sortable="true" align="right"   width="70"  editor="{type: 'numberbox',options:{min: 0, precision: 0}}"  >数量       </th>  
            <th field="Remark"          sortable="true" align="left"    width="90"  editor="text"   >备注   </th>  
        </tr>                            
    </thead>      
</table> 